<?php

require_once 'smarty_lib/Smarty.class.php';
require_once 'lib/DBClass.php';
require_once 'lib/Account.php';
require_once 'lib/Produk.php';

$smarty = new Smarty();
$acc = new Account();
$pro = new Produk();

$smarty->template_dir = 'template/';
$smarty->compile_dir = 'template_c/';

if(!$acc->validate_cookie()){
	$smarty->assign('error','Anda tidak mepunyai akses untuk membuka halaman ini');
	$smarty->display('index.html');
}else{
	
	$smarty->assign('cookie', $acc->get_cookie());
	$smarty->assign('page','tambahpro.html');
	$smarty->assign('title','Produk');

	$smarty->display('dashboard.html');
}
if(isset($_POST['submit'])){
	$data = $pro->add_pro();
	$smarty->assign('pro', $data);
}
?>